package cn.com.nxt.txb.adapter;


import android.support.v4.view.PagerAdapter;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import java.util.ArrayList;

/**
 * Created by zhangling on 2017/6/15.
 */

public class InviteAdapter extends PagerAdapter {
    ArrayList<FrameLayout> frameLayouts;


    public InviteAdapter(ArrayList<FrameLayout> frameLayouts) {
        this.frameLayouts = frameLayouts;
    }


    @Override
    public int getCount() {
        return frameLayouts.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }


    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        FrameLayout recyclerView = frameLayouts.get(position);
        container.addView(recyclerView);
        return recyclerView;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(frameLayouts.get(position));
    }
}
